package com.ymttest.database.sqlwapper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.BusinessCredentialInfo;

public class BusinessCredentialInfoWapper {
	SqlManager manage;

	public BusinessCredentialInfoWapper() {
		manage = new SqlManager("intpro");
	}


	public List<BusinessCredentialInfo> selectByProductId(String productId)throws InterruptedException {
		 List<BusinessCredentialInfo>  ret = manage.getSelectResults(
		            "com.ymttest.database.mapping.BusinessCredentialInfoMapper.selectByProductId", productId);
//		    manage.commit();
		    return ret;
	}
	
	
	public List<BusinessCredentialInfo> selectByProductIdAndType(String productId,String actionType)throws InterruptedException {
		Map<String,Object> map = new HashMap<>();
		
		map.put("ProductId", productId);
		map.put("ActionType", actionType);
		List<BusinessCredentialInfo>  ret = manage.getSelectResults(
		            "com.ymttest.database.mapping.BusinessCredentialInfoMapper.selectByProductIdAndType", map);
//		    manage.commit();
		    return ret;
	}

	public static void main(String args[]) throws InterruptedException {
	   List<String> a = new ArrayList<>();
	   a.add("c");
	   List<String> b =  a.stream().filter(x->x.equals("d")).collect(Collectors.toList());
		System.out.println( new BusinessCredentialInfoWapper().selectByProductIdAndType("b526635b-95e2-4cf4-99bd-e9b1bc23433b","CatalogStockChange").size());
	}
	
}
